<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // Promise常用的API-实例方法
        console.dir(Promise) //在控制台查看 prototype属性

        // ********************************************************
        function foo(){
            return new Promise(function(resolve,reject){
                setTimeout(() => {
                    resolve(123)
                }, 1000);
            })
        }
        foo()
            .then(function(res){
                console.log(res)
            })
            .catch(function(res){
                console.log(res)
            })
            .finally(function(){
                console.log('finished')
            })
    </script>
</body>
</html>